package com.edbergogroup.springexamples.aop.apekter;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class NullCheckAspekt {

	@Before("execution(Integer com.edbergogroup.springexamples.aop.MyServiceI+.multiply(Integer,Integer))")
	public void ChangeNullValues(JoinPoint jp) {
		System.out.println("Hello World. Values in and b is : "
				+ jp.getArgs()[0] + " and " + jp.getArgs()[1]);
		if ((jp.getArgs()[0] == null) || (jp.getArgs()[1] == null)) {
			throw new IllegalArgumentException("Null values not alowed");
		}
	}

//	@Before("com.edbergogroup.springexamples.aop.MyServiceI+.multiply2(Integer) &&args(a)")
//    public void test(Integer a) {

//}


}
